<?php

/**
 * Categoires - Items & Brands
 * 
 * @project : Loobica
 * @author  : Dino
 * @date    : 28 Mar 2014
 * 
 */
if (!defined('BASEPATH'))
  exit('No direct script access allowed');

class Categories extends LB_Controller {

  /**
   * Show Items List by Category
   * 
   */
  public function items() {

    // Get Categories
    $categories = $this->category_model->get_categories();

    // Get & Inject Items
    if (!empty($categories)) {
      foreach ($categories as $key => $value) {
        $categories[$key]['items'] = $this->filter_model->get_items($value['category_id']);
      }
    }

    // Preparing & Loading View
    $view_data = array();
    $view_data['title'] = 'Category - Item';
    $view_data['categories'] = $categories;
    $this->load_view('category/categories_items', $view_data);
  }

  /**
   * Show Brands List by Category
   * 
   */
  public function brands() {

    // Get Categories
    $categories = $this->category_model->get_categories();

    // Get & Inject Items
    if (!empty($categories)) {
      foreach ($categories as $key => $value) {
        $categories[$key]['brands'] = $this->filter_model->get_brands($value['category_id']);
      }
    }

    // Preparing & Loading View
    $view_data = array();
    $view_data['title'] = 'Category - Brand';
    $view_data['categories'] = $categories;
    $this->load_view('category/categories_brands', $view_data);
  }

}

?>